
const { createWebAPIRequest } = require('../../util/util')

module.exports = [
  {
    /**
    * @api {get} /music/fm/trash [垃圾桶]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {id} id
    * @apiParam {Number} [time=25]
    */
    url: '/music/fm/trash',
    request: (req, res) => {
      const cookie = req.get('Cookie') || ''
      const songId = req.query.id
      const alg = 'RT'
      const time = req.query.time || 25
      const data = {
        csrf_token: '',
        songId
      }

      createWebAPIRequest(
        'music.163.com',
        `/weapi/radio/trash/add?alg=${alg}&songId=${songId}&time=${time}`,
        'POST',
        data,
        cookie,
        musicReq => res.send(musicReq),
        err => res.status(500).send({err})
      )
    }
  }
]
